﻿<%@ WebHandler Language="C#" Class="SysRight_GetAllByRoseId" %>

using System;
using System.Web;
using Newtonsoft.Json;
using System.Collections.Generic;

public class SysRight_GetAllByRoseId : IHttpHandler, System.Web.SessionState.IReadOnlySessionState
{
    
    public void ProcessRequest (HttpContext context) {
 //检验是否登录

        if (!OTS.BaseLogin.validataModule(context, (int)OTS.enumSysRight.SysRose))
        {
            context.Response.ContentType = "text/json";
            context.Response.Write("非法操作！");
            return;

        }
        else
        {
            string _rid = context.Request["rid"];
            string result = "";
            OTS.Common.Page<OTS.Model.sys_right> page = new OTS.Common.Page<OTS.Model.sys_right>();
            OTS.BLL.SysRoseBLL bll = new OTS.BLL.SysRoseBLL();
            if (null != _rid && OTS.Common.Help.IsNumber(_rid))
            {

                List<OTS.Model.sys_right> list = bll.GetAllSysRightByRoseID(int.Parse(_rid));
                for (int i = 0; i < list.Count; i++)
                {
                    OTS.Model.sys_right node = list[i];
                    if (i == 0)
                        result = node.rtid + "";
                    else
                        result = result + "," + node.rtid;
                }
                page.msg = result;
                page.success = true;
            }
            else
            {
                page.success = false;
            }
            
            context.Response.ContentType = "text/json";
            context.Response.Write(JavaScriptConvert.SerializeObject(page));
        }
    }
 
    public bool IsReusable {
        get {
            return false;
        }
    }

}